import { Button, Modal } from 'antd';

export interface CommonReloadModalProps {
  open: boolean;
  loading: boolean;
  reloadPage: () => void;
  backHome: () => void;
  message: string;
}

export default function CommonReloadModal(props: CommonReloadModalProps) {
  return (
    <Modal
      title='提示'
      open={props.open}
      centered
      onCancel={props.reloadPage}
      footer={[
        <Button
          onClick={props.backHome}
          key='backHome'
        >
          返回主页
        </Button>,
        <Button
          type='primary'
          loading={props.loading}
          onClick={props.reloadPage}
          key='reloadPage'
        >
          刷新页面
        </Button>,
      ]}
    >
      <p>{props.message}</p>
    </Modal>
  );
}
